<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS3心跳效果</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
            font-family: 'Arial', sans-serif;
        }

        .heart-container {
            text-align: center;
        }

        .heart {
            position: relative;
            width: 100px;
            height: 90px;
            margin: 0 auto 20px;
            animation: heartbeat 1s infinite;
        }

        .heart:before,
        .heart:after {
            content: '';
            position: absolute;
            top: 0;
            width: 52px;
            height: 80px;
            border-radius: 50px 50px 0 0;
            background: #e74c3c;
        }

        .heart:before {
            left: 50px;
            transform: rotate(-45deg);
            transform-origin: 0 100%;
        }

        .heart:after {
            left: 0;
            transform: rotate(45deg);
            transform-origin: 100% 100%;
        }

        @keyframes heartbeat {
            0% {
                transform: scale(0.8);
            }
            5% {
                transform: scale(0.9);
            }
            10% {
                transform: scale(0.8);
            }
            15% {
                transform: scale(1.1);
            }
            50% {
                transform: scale(0.8);
            }
            100% {
                transform: scale(0.8);
            }
        }

        h2 {
            color: #333;
            margin-bottom: 10px;
        }

        p {
            color: #666;
            max-width: 500px;
        }
    </style>
</head>
<body>
    <div class="heart-container">
        <h2>CSS3心跳动画效果</h2>
        <div class="heart"></div>
        <p>这个效果使用CSS3的animation和transform属性实现。通过伪元素:before和:after创建心形，然后使用@keyframes定义缩放动画来模拟心跳效果。</p>
    </div>
</body>
</html>